#include "gisdataoperate.h"
#include <QAction>
#include <QDebug>
#include "Frame/imainframeservice.h"
#include <QIcon>

void GisDataOperate::start(IBundleContext::Ptr context)
{
    IServiceReference reference= context->getServiceReference<IMainFrameService>();

    if(reference){
        IMainFrameService *hello = context->getService<IMainFrameService>(reference,nullptr);
		mpDataManager = hello->getDataManager();

        mpRemoveEmptyTile = new QAction(QIcon(":/res/trash.png"),tr("RemoveEmptyTile"),nullptr);
        connect(mpRemoveEmptyTile,SIGNAL(triggered()),this,SLOT(slot_RemoveEmptyTile()));
        // please modify page and group name
        hello->addFrameAction(QString("dituguanli"),QString("ditucaozuo"),mpRemoveEmptyTile);

    }
}

void GisDataOperate::stop(IBundleContext::Ptr context)
{
    Q_UNUSED(context)
    IServiceReference reference= context->getServiceReference<IMainFrameService>();

    if(reference){
        IMainFrameService *hello = context->getService<IMainFrameService>(reference,nullptr);

        hello->removeFrameAction(QString("renwuguanli"),QString("ditucaozuo"),mpRemoveEmptyTile);
        delete mpRemoveEmptyTile;

    }
}

void GisDataOperate::slot_RemoveEmptyTile()
{

}



//Qt4
#if(QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
Q_EXPORT_PLUGIN2(GisDataOperateHMP, GisDataOperate)
#endif
